package leetcode.剑指offer;

import java.util.HashSet;
import java.util.Set;

public class 数组中重复的数字03 {
    public int findRepeatNumber(int[] nums) {
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            int temp = nums[i];
            if(set.contains(temp))
                return temp;
            set.add(temp);
        }
        return -1;

    }
}
